CXX = g++
CC = gcc
STRIP = strip

.PHONY: default  clean

SUB = ./sub
PUB = ./pub
TARGET = $(SUB) $(PUB) 
CFLAGS = -Wall
default: $(TARGET) 

INCLUDE = -I ../3rdpart/zmq/include/ 

LIBS = -L ../3rdpart/zmq/lib/  -lzmq
OBJECTS += $(patsubst %.cpp, %.o, $(wildcard *.cpp))

$(SUB): sub.o
	$(CXX) $(INCLUDE) $(CFLAGS) sub.o -w $(LDFLAGS) $(LIBS) -ldl -lpthread -o $(SUB)
	$(STRIP) $(SUB) 
	@ rm -rf sub.o 

$(PUB): pub.o
	$(CXX) $(INCLUDE) $(CFLAGS) pub.o -w $(LDFLAGS) $(LIBS) -ldl -lpthread -o $(PUB)
	$(STRIP) $(PUB) 
	@ rm -rf pub.o 
	
%.o:%.cpp
	$(CXX) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -c $^ -o $@

clean:
	@ rm -rf $(TARGET)
